-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add leader election mechanism #1285
base: develop
Are you sure you want to change the base?
Conversation
cmd/controller/main.go
Outdated
client *clientset.Clientset | ||
) | ||
|
||
func getNewLock(lockname, podname, namespace string) *resourcelock.LeaseLock { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Early Feedback: Can we move all the leader election code to a different file / module? Main ought to be as simple as possible (just start the app)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay will look into this
Hi @basit9958 , thanks for this! Is this PR intended to be for demonstration / Proof of Concept purposes - or the intended feature complete? If it's intended to be complete, looks like it doesn't compile right now.
|
It is meant to be complete, I will fix these errors |
Signed-off-by: Basit Hasan <[email protected]>
Signed-off-by: Basit Hasan <[email protected]>
Signed-off-by: Basit Hasan <[email protected]>
Signed-off-by: Basit Hasan <[email protected]>
What this PR does / why we need it:
Added Leader Election Mechanism
OnStartedLeading
: This callback is executed when the current instance becomes the leader. It starts running the controller logic by calling the Run function.OnStoppedLeading
: This callback is executed when the current instance is no longer the leader. It logs a message and may exit gracefully if needed.OnNewLeader
: This callback is executed when a new leader is elected. It logs a message indicating the new leader's identity.Which issue(s) this PR fixes:
Fixes #838
Does this PR introduce a user-facing change?
Additional Notes for your reviewer:
Review Checklist:
a link to that PR
change
Additional documentation e.g., Proposal, usage docs, etc.: